// 1.0 导入vue核心包
import Vue from 'vue';


// 2.0 导入App.vue的vue对象
import App from './App.vue';


// 3.0 vue-router相关的代码
// 3.0.1 导入vue-router这个包
import VueRouter from 'vue-router';  //相当于 <script src="vue-router.js">
// 3.0.2 在Vue对象中通过use()方法来使用vue-router对象
Vue.use(VueRouter);
// 3.0.3 定义路由对象并且初始化路由规则
// 3.0.3.1 导入需要注册的组件
import home from './components/Home.vue';
import shopcar from './components/shopcar/car.vue';
import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';
import photolist from './components/photo/photolist.vue';
import photoinfo from './components/photo/photoinfo.vue';
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodsdesc from './components/goods/goodsdesc.vue';
import goodscomment from './components/goods/goodscomment.vue';
// 3.0.2 定义路由规则
var router1 = new VueRouter({
linkActiveClass :'mui-active', //将激活的路由添加一个mui-active类名称
routes:[
	{path:'*',redirect:"/home"},
    {path:'',redirect:"/home"}, 
	{path:'/Home',component:home},//首页
	{path:'/shopcar',component:shopcar},//购物车
	{path:'/news/newslist',component:newslist},//新闻
	{path:'/news/newsinfo/:id',component:newsinfo},//新闻评论
	{path:'/photo/photolist/',component:photolist},//图片分享
	{path:'/photo/photoinfo/:id',component:photoinfo},
	{path:'/goods/goodslist',component:goodslist},
	{path:'/goods/goodsinfo/:id',component:goodsinfo},
	{path:'/goods/goodsdesc/:id',component:goodsdesc},
	{path:'/goods/goodscomment/:id',component:goodscomment},
]
});


// 4.0 注册mint-ui
// 导入mint-ui的css文件
import 'mint-ui/lib/style.min.css';
// 导入mint-ui组件对象
import mintui from 'mint-ui';
// 在Vue中全局使用mintui
Vue.use(mintui);


//5.0 导入mui 样式
import '../statics/mui/css/mui.css';
import '../statics/mui/css/icons-extra.css';


//6.0 导入全局样式
import '../statics/css/site.css';

//7.0 绑定vue-resourcs
import vueResource from 'vue-resource';
Vue.use(vueResource);

//8.0 定义全局过滤器实现日期的格式化
import moment from 'moment';
Vue.filter('datefmt',function(input,fmtstring) {
	return moment(input).format(fmtstring);
});

// 9.0 使用图片预览组件
// import VuePreview from 'vue-preview';
// Vue.use(VuePreview);

// 利用Vue对象进行解析渲染
new Vue({
	el:'#app',
	// render:function(create){create(App)} //es5的写法
	router:router1,
	render:c=>c(App)  // es6的函数写法 =>：goes to
});